﻿using LY.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LY.DataAccess.Repository
{
    public class DocumentRepository : BaseRepository
    {
        //根据项目Id查询信息
        public List<T_Document> GetDocumentList(int? id)
        {
            string sql = @" SELECT [Id]
                          ,[ProjectId]
                          ,[Type]
                          ,[DocPath]
                          FROM [zhongchou].[dbo].[T_Document]
                            where ProjectId=@ProjectId";
            return base.Query<T_Document>(sql, new { ProjectId = id });
        }


        //根据主键Id查询信息
        public string GetDocumentListbyId(int? id)
        {
            string sql = @" SELECT [DocPath]
                          FROM [zhongchou].[dbo].[T_Document]
                            where Id=@Id";
            return base.Get<T_Document>(sql, new { Id = id }).DocPath;
        }

        //删除
        public int DeleteImagesbyID(int? id)
        {
            string sql = "delete from T_Document where Id=@Id ";
            return base.Excute(sql, new { Id = id });
        }

    }
}
